#pragma once
#include "../MCHdTree/CMCTreeCtrl.h"

/*
if use MFC firmwork, the base class should be CView,
else use CWnd as base class!!!
*/
#define CMCT_BASE_CLASS CView

// CMCHTreeView view

class CMCHTreeView : public CMCT_BASE_CLASS /* CWnd/CView */
{
	DECLARE_DYNCREATE(CMCHTreeView)


protected:
	CMCHTreeView();           // protected constructor used by dynamic creation
	virtual ~CMCHTreeView();

public:
	virtual void OnDraw(CDC* pDC){};      // overridden to draw this view
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

//////////////////////////////
//
// message handle
//
protected:
	DECLARE_MESSAGE_MAP()

public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnSize(UINT nType, int cx, int cy);

	afx_msg void OnHdNtf(NMHDR* pNMHDR, LRESULT* pResult);

	afx_msg void OnEditPaste();
	afx_msg void OnEditCopy();
	afx_msg void OnEditCut();

private:
	void RePosCtrl(void);
    void SetHScroll(int cx);

protected:
	enum enMCTSubId { HEADER_ID = 1, TREE_ID = 2 };

public:
	CMCTreeCtrl& GetTreeCtrl() { return m_cMCTree; }
	CHeaderCtrl& GetHeaderCtrl() { return m_cHeader; }

//
// call these functions to insert delete colmns, don't use CHeaderCtrl's function
//
public:
	BOOL InsertMCTClmn(int nPos, HDITEM* phdi, WORD wSubId, DWORD dwFlag=0);
	BOOL DeleteMCTClmn(int nPos);

protected:
	CMCTreeCtrl m_cMCTree;
	CHeaderCtrl m_cHeader;
	DWORD m_dwHdcy;	// the higth of header

	DWORD m_dwCharWidth;	// the width of a "char". Should call GetTextMetrics to get this value, but use the default(8) now

	// tree style modify it before call OnCreate
	DWORD m_dwCreateStyle;
};


